﻿<UserControl x:Class="Big3.Hitbase.MainControls.MyMusicTable"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:dd="clr-namespace:Big3.Hitbase.Controls.DragDrop;assembly=Controls"
             xmlns:hc="clr-namespace:Big3.Hitbase.Controls;assembly=Controls"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Big3.Hitbase.MainControls"
             xmlns:misc="clr-namespace:Big3.Hitbase.Miscellaneous;assembly=Misc"
             xmlns:sr="clr-namespace:Big3.Hitbase.SharedResources;assembly=Big3.Hitbase.SharedResources"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="900" Unloaded="UserControl_Unloaded">
    <UserControl.Resources>
        <misc:SingleLineConverter x:Key="singlelineConverter" />
        <local:TrackColorForegroundConverter x:Key="trackColorForegroundConverter" />
        <Style x:Key="MultilineButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" >
        </Style>
        <DataTemplate x:Key="CommentTemplate">
            <DockPanel MouseEnter="DockPanelMultiLineEdit_MouseEnter" MouseLeave="DockPanelMultiLineEdit_MouseLeave">
                <Button Name="MultiLineEditButton" Visibility="Collapsed" DockPanel.Dock="Right" Click="ButtonMultiLineEdit_Click" Background="Transparent" Style="{StaticResource MultilineButtonStyle}" >
                    <Image Height="11" Width="11" Source="pack://application:,,,/Big3.Hitbase.SharedResources;component/Images/edit.png"></Image>
                </Button>
                <TextBlock Margin="1" Text="{Binding Comment, Converter={StaticResource singlelineConverter}}" TextTrimming="CharacterEllipsis" />
            </DockPanel>
        </DataTemplate>
    </UserControl.Resources>
    <UserControl.CommandBindings>
        <CommandBinding Command="sr:HitbaseCommands.CopyToClipboard" Executed="CommandBindingCopyToClipboard_Executed" />
    </UserControl.CommandBindings>
        <DataGrid CanUserAddRows="False" CanUserResizeRows="False" BorderThickness="0" HeadersVisibility="Column" RowHeaderWidth="0" CanUserDeleteRows="False" 
              SelectionUnit="FullRow" EnableRowVirtualization="True" EnableColumnVirtualization="True" AutoGenerateColumns="False" Name="dataGrid" 
              PreviewMouseDoubleClick="dataGrid_PreviewMouseDoubleClick" dd:DragDrop.IsDragSource="true" dd:DragDrop.IsDropTarget="false" CellEditEnding="dataGrid_CellEditEnding" Sorting="dataGrid_Sorting" >
        <DataGrid.ContextMenu >
            <ContextMenu DataContext="{Binding RelativeSource={RelativeSource Mode=Self}, Path=PlacementTarget}">
                <ContextMenu.CommandBindings>
                    <CommandBinding Command="sr:HitbaseCommands.ChooseColumns" Executed="CommandBindingChooseColumns_Executed" />
                    <CommandBinding Command="sr:HitbaseCommands.Rename" Executed="CommandBindingRename_Executed" />
                </ContextMenu.CommandBindings>
                <MenuItem Header="Umbenennen" Command="sr:HitbaseCommands.Rename">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/Rename.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="Sofort spielen" Click="MenuItemAddTracksToPlaylistPlayNow_Click">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/PlayNowBlack.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Als nächstes spielen" Click="MenuItemAddTracksToPlaylistPlayNext_Click">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/PlayNextBlack.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Als letztes spielen" Click="MenuItemAddTracksToPlaylistPlayLast_Click">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/PlayLastBlack.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Vorhören (Pre-Listen)" Click="MenuItemAddTracksToPlaylistPreListen_Click">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/PlayPreListenBlack.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="Zur Wunschliste hinzufügen" Command="sr:HitbaseCommands.AddToWishlist" CommandParameter="{Binding SelectedItem.ID}">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/AddToWishlist.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="Speicherort öffnen" Command="sr:HitbaseCommands.OpenTrackLocation" CommandParameter="{Binding SelectedItem.ID}">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/OpenFolder.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="In die Zwischenablage kopieren" Command="sr:HitbaseCommands.CopyToClipboard">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/Copy.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="Spalten wählen..." Command="sr:HitbaseCommands.ChooseColumns">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/ChooseColumns.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="Eigenschaften" Command="sr:HitbaseCommands.OpenTrack" CommandParameter="{Binding SelectedItem.ID}">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/Properties.png" />
                    </MenuItem.Icon>
                </MenuItem>
            </ContextMenu>
        </DataGrid.ContextMenu>
        <DataGrid.CellStyle>
            <Style TargetType="{x:Type DataGridCell}">
                <Setter Property="TextElement.Foreground" Value="{Binding Converter={StaticResource trackColorForegroundConverter}, IsAsync=True, FallbackValue=Black, Mode=OneWay}"></Setter>
            </Style>
        </DataGrid.CellStyle>

    </DataGrid>
</UserControl>
